package com.hushao.lims.weblims.repository;

import com.hushao.lims.weblims.domain.EquipmentApply;
import com.hushao.lims.weblims.domain.EquipmentInfo;
import com.hushao.lims.weblims.domain.TeacherInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @author 930588706
 * @date 18/1/25
 */
public interface EquipmentApplyRepository extends JpaRepository<EquipmentApply,Long> {
    /**
     * 根据器材，数量，状态，查询申请器材信息
     * @param equipmentInfo
     * @param count
     * @param state
     * @return
     */
    List<EquipmentApply> findByEquipmentInfoAndEquipmentApplyCountAndEquipmentApplyState(EquipmentInfo equipmentInfo, Integer count, String state);

    /**
     * 根据器材，教师，状态查询借出的器材
     * @param equipmentInfo
     * @param teacherInfo
     * @param state
     * @return
     */
    List<EquipmentApply> findByEquipmentInfoAndTeacherInfoAndEquipmentApplyState(EquipmentInfo equipmentInfo, TeacherInfo teacherInfo, String state);

    Page<EquipmentApply> findByEquipmentInfo_EquipmentNameLikeAndEquipmentApplyStateLike(String equipment, String state, Pageable pageable);
}
